package com.serviceprovider.business.module.admin.faq.model;

//~--- JDK imports ------------------------------------------------------------

import java.text.DateFormat;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Faq {
    private String answer;
    private String answerFull;
    private Date   created;
    private int    id;
    private String question;
    private String questionFull;
    private int    rating;
    private String tag;
    private String tagFull;
    private Date   updated;

    @Override
    public boolean equals(Object obj) {
        if ((obj == null) ||!(obj instanceof Faq)) {
            return false;
        }

        Faq     b  = (Faq) obj;
        boolean eq = (id == b.id);

        if (!eq) {
            return false;
        }

        eq = ((question == null) && (b.question == null)) || ((question != null) && question.equals(b.question));

        if (!eq) {
            return false;
        }

        eq = ((questionFull == null) && (b.questionFull == null))
             || ((questionFull != null) && questionFull.equals(b.questionFull));

        if (!eq) {
            return false;
        }

        eq = ((answer == null) && (b.answer == null)) || ((answer != null) && answer.equals(b.answer));

        if (!eq) {
            return false;
        }

        eq = ((answerFull == null) && (b.answerFull == null))
             || ((answerFull != null) && answerFull.equals(b.answerFull));

        if (!eq) {
            return false;
        }

        eq = ((tag == null) && (b.tag == null)) || ((tag != null) && tag.equals(b.tag));

        if (!eq) {
            return false;
        }

        eq = ((tagFull == null) && (b.tagFull == null)) || ((tagFull != null) && tagFull.equals(b.tagFull));

        if (!eq) {
            return false;
        }

        eq = (rating == b.rating);

        if (!eq) {
            return false;
        }

        eq = ((created == null) && (b.created == null)) || ((created != null) && created.equals(b.created));

        if (!eq) {
            return false;
        }

        eq = ((updated == null) && (b.updated == null)) || ((updated != null) && updated.equals(b.updated));

        if (!eq) {
            return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        int prime  = 31;
        int result = 1;

        result = prime * result + id;
        result = prime * result + ((question == null)
                                   ? 0
                                   : question.hashCode());
        result = prime * result + ((questionFull == null)
                                   ? 0
                                   : questionFull.hashCode());
        result = prime * result + ((answer == null)
                                   ? 0
                                   : answer.hashCode());
        result = prime * result + ((answerFull == null)
                                   ? 0
                                   : answerFull.hashCode());
        result = prime * result + ((tag == null)
                                   ? 0
                                   : tag.hashCode());
        result = prime * result + ((tagFull == null)
                                   ? 0
                                   : tagFull.hashCode());
        result = prime * result + rating;
        result = prime * result + ((created == null)
                                   ? 0
                                   : created.hashCode());
        result = prime * result + ((updated == null)
                                   ? 0
                                   : updated.hashCode());

        return result;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getQuestion() {
        return question;
    }

    public void setQuestion(String question) {
        this.question = question;
    }

    public String getAnswer() {
        return answer;
    }

    public void setAnswer(String answer) {
        this.answer = answer;
    }

    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    public int getRating() {
        return rating;
    }

    public void setRating(int rating) {
        this.rating = rating;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public Date getUpdated() {
        return updated;
    }

    public void setUpdated(Date updated) {
        this.updated = updated;
    }

    public String getCreatedDatetime() {
        DateFormat dateFormater = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        return dateFormater.format(created);
    }

    public String getUpdatedDatetime() {
        DateFormat dateFormater = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        return dateFormater.format(updated);
    }

    public String getQuestionFull() {
        return questionFull;
    }

    public void setQuestionFull(String questionFull) {
        this.questionFull = questionFull;
    }

    public String getAnswerFull() {
        return answerFull;
    }

    public void setAnswerFull(String answerFull) {
        this.answerFull = answerFull;
    }

    public String getTagFull() {
        return tagFull;
    }

    public void setTagFull(String tagFull) {
        this.tagFull = tagFull;
    }
}



